<?php

/**
 * User:ayou chow
 * Date: 2020-02-12
 * Time: 14:50
 */

namespace app\common\model;


use think\Model;

class FootballMatchModel extends Model
{
    protected $connection = 'db_sports';

    public function matchevent()
    {
        return $this->hasOne('FootballMatcheventModel', 'id', 'competition_id');
    }

    public function hometeam()
    {
        return $this->hasOne(FootballTeamModel::class, 'id', 'home_team_id');
    }

    public function awayteam()
    {
        return $this->hasOne(FootballTeamModel::class, 'id', 'away_team_id');
    }

    public function rec()
    {
        return $this->hasOne('FootballMatchRecModel', 'matchid', 'id');
    }

    public function url()
    {
        return $this->hasOne(MatchesModel::class, 'match_id', 'id');
    }

    public function live()
    {
        return $this->hasOne(MatchesModel::class, 'match_id', 'id');
    }

    public function venue()
    {
        return $this->hasOne(FootballVenueModel::class, 'id', 'venue_id');
    }
}
